﻿<phone:PhoneApplicationPage 
    x:Class="AuchanScan.Views.SearchPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d" d:DesignHeight="768" d:DesignWidth="480"
    shell:SystemTray.IsVisible="True">

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot">
        <Grid.Background>
            <ImageBrush Stretch="Fill" ImageSource="/images/Page_Background2.png"/>
        </Grid.Background>
        <TextBox TextWrapping="Wrap" VerticalAlignment="Top"  KeyDown="TextBox_KeyDown"/>
        <ListBox ItemsSource="{Binding Results}" Margin="0,80,0,0">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <StackPanel>
                        <TextBlock Text="{Binding Key}" FontSize="48" />
                        <Button Style="{StaticResource ButtonNoStyle}" >
                            <Grid Margin="0,0,0,6" DataContext="{Binding Value}">

                                <Grid.RowDefinitions>
                                    <RowDefinition Height="auto" />
                                    <RowDefinition Height="auto" />
                                </Grid.RowDefinitions>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="*" />
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="Auto" />
                                </Grid.ColumnDefinitions>
                                <TextBlock Text="{Binding Quantity}" Style="{StaticResource PhoneTextLargeStyle}" VerticalAlignment="Center"  />
                                <TextBlock Text="{Binding Product.Name}" Grid.Column="1" Style="{StaticResource PhoneTextLargeStyle}" VerticalAlignment="Center" TextWrapping="Wrap"/>
                                <TextBlock Text="{Binding TotalPrice}" Grid.Column="2" Style="{StaticResource PhoneTextLargeStyle}" VerticalAlignment="Top" Margin="12,0,0,0"  />
                                <TextBlock Text="€" Grid.Column="3" Style="{StaticResource PhoneTextLargeStyle}" VerticalAlignment="Top"  />
                                <Grid Visibility="{Binding HasPromo,Converter={StaticResource VisibilityConverter}}" Grid.ColumnSpan="4" Grid.Row="1" Margin="0,0,12,0"
             >
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="60"/>
                                        <ColumnDefinition Width="auto"/>
                                        <ColumnDefinition Width="*"/>
                                        <ColumnDefinition Width="auto"/>
                                    </Grid.ColumnDefinitions>
                                    <Path Visibility="{Binding UsePromo, Converter={StaticResource VisibilityConverter}}" Data="M0,119 L31,92 L119,185 L267,0 L300,24 L122,250 z" Fill="{StaticResource PhoneRadioCheckBoxCheckBrush}" HorizontalAlignment="Center" Height="18" IsHitTestVisible="False" Stretch="Fill" StrokeThickness="2" StrokeLineJoin="Round" VerticalAlignment="Center" Width="24" UseLayoutRounding="False" Grid.Column="3"/>
                                    <Border 	Visibility="{Binding HasPromo, Converter={StaticResource VisibilityConverter}}" 
		 		Background="{StaticResource AccentBrushScan}" Grid.Column="1" Width="4" HorizontalAlignment="Left" />
                                    <TextBlock Text="{Binding Promotion.Comment1}" Style="{StaticResource PhoneTextSubtleStyle}" VerticalAlignment="Center" Grid.Column="2" FontSize="21.333" />
                                </Grid>
                            </Grid>
                        </Button>
                    </StackPanel>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
    </Grid>
</phone:PhoneApplicationPage>
